
import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
import * as echarts from "echarts" // 引入echarts
import DataVVue3 from '@kjgl77/datav-vue3'
import 'amfe-flexible'
import axios from "axios"
const app = createApp(App)
app.config.globalProperties.$echarts = echarts // 全局使用
app.config.globalProperties.$axios = axios;
// 定义全局指令提交仓库
app.directive('resize', { // 使用局部注册指令的方式
    // 指令的名称
    mounted(el, binding) { // el为绑定的元素，binding为绑定给指令的对象
      let width = '',
        height = '';
  
      function isReize() {
        const style = document.defaultView.getComputedStyle(el);
        if (width !== style.width || height !== style.height) {
          binding.value(); // 关键
        }
        width = style.width;
        height = style.height;
      }
      el.__vueSetInterval__ = setInterval(isReize, 300);
    },
    unmounted(el) {
      clearInterval(el.__vueSetInterval__);
    }
  
  })
  
app.use(createPinia())
app.use(router)
app.use(DataVVue3)
app.mount('#app')
